<!DOCTYPE html>
<html>
<meta charset="utf-8">
 <title></title>
 <#include "/header.html">
<body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight" id="rrapp">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox-content">
		   <form class="form-horizontal">
                   <div class="form-group">
                        <div class="col-sm-2 control-label">广告位名称</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="advPosition.name" placeholder="广告位名称"/>
                        </div>
                    </div>

                 <div class="form-group">
                        <div class="col-sm-2 control-label">广告位简介</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="advPosition.description" placeholder="广告位简介"/>
                        </div>
                    </div>

					<div class="form-group">
                        <div class="col-sm-2 control-label">广告位编码</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="advPosition.code" placeholder="广告位编码"/>
                        </div>
                    </div>

					<div class="form-group">
				           <div class="col-sm-3 control-label"></div>
				          <input type="button" class="btn btn-primary"  @click="saveOrUpdate" value="确定"/>
				         &nbsp;&nbsp;<input type="button" class="btn btn-warning"    onclick="closeContent();" value="返回"/>
                    </div>
        </form>
			
			
	 
				</div>
				
			</div>
		</div>
		
	</div>
 	<script>
	 
  function closeContent(){
 	 
 		var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
 	}  
  
    $(document)
	.ready(
			function() {
				vm.getInfo();	
			});  
  
 
 var vm = new Vue({
	el:'#rrapp',
	data:{
		showList: true,
		title: null,
		advPosition: {
		id:T.p("id"),
		}
	},
	methods: {
		query: function () {
			vm.reload();
		} ,
		saveOrUpdate: function (event) {
			var url = vm.advPosition.id == null ? "AdvPosition/advposition/save" : "AdvPosition/advposition/update";
			$.ajax({
				type: "POST",
			    url: baseURL + url,
                contentType: "application/json",
			    data: JSON.stringify(vm.advPosition),
			    success: function(r){
			    	if(r.code === 0){
						alert('操作成功', function(index){
						parent.vm.reload();
				var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
				parent.layer.close(index);
						});
					}else{
						alert(r.msg);
					}
				}
			});
		} ,
		getInfo: function(){
		 if(!T.p("id")){
				 return;
			 }
			$.get(baseURL + "AdvPosition/advposition/info/"+T.p("id"), function(r){
                vm.advPosition = r.advPosition;
            });
		} 
	}
});
	</script>
	
	
</body>
</html>
